<template>
  <van-tabbar route v-model="active" @change="onChange">
    <van-tabbar-item replace to="/" icon="video-o">电影</van-tabbar-item>
    <van-tabbar-item replace to="/cinemas" icon="hotel-o">影院</van-tabbar-item>
    <van-tabbar-item icon="newspaper-o">资讯</van-tabbar-item>
    <van-tabbar-item icon="contact-o">我的</van-tabbar-item>
  </van-tabbar>
</template>
<script setup>
import { ref } from 'vue'
import { useStore } from "@/stores/index.js"
const store = useStore()
const active = ref(0)
const onChange = (active) => {
  console.log("active:", active);
  store.setPageNum(1) //  【非常重要】 切换页面时，重置页码为1
}
</script>
